﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcps.Web.badinfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtbno.Text.Trim().Length==0)
			{
				strErr+="bno不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtbtime.Text))
			{
				strErr+="btime格式错误！\\n";	
			}
			if(this.txtsupplier.Text.Trim().Length==0)
			{
				strErr+="supplier不能为空！\\n";	
			}
			if(this.txtquestion.Text.Trim().Length==0)
			{
				strErr+="question不能为空！\\n";	
			}
			if(this.txtdispose.Text.Trim().Length==0)
			{
				strErr+="dispose不能为空！\\n";	
			}
			if(this.txtdisresult.Text.Trim().Length==0)
			{
				strErr+="disresult不能为空！\\n";	
			}
			if(this.txtremark.Text.Trim().Length==0)
			{
				strErr+="remark不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string bno=this.txtbno.Text;
			DateTime btime=DateTime.Parse(this.txtbtime.Text);
			string supplier=this.txtsupplier.Text;
			string question=this.txtquestion.Text;
			string dispose=this.txtdispose.Text;
			string disresult=this.txtdisresult.Text;
			string remark=this.txtremark.Text;

			lcps.Model.badinfo model=new lcps.Model.badinfo();
			model.bno=bno;
			model.btime=btime;
			model.supplier=supplier;
			model.question=question;
			model.dispose=dispose;
			model.disresult=disresult;
			model.remark=remark;

			lcps.BLL.badinfo bll=new lcps.BLL.badinfo();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
